CREATE TABLE [dbo].[Purchase]
(
[PurchaseId] [int] NOT NULL IDENTITY(1, 1),
[OrderId] [int] NOT NULL,
[ProductId] [int] NOT NULL,
[Quantity] [int] NOT NULL,
[CreatedDate] [datetime] NOT NULL,
[LastModifiedDate] [datetime] NOT NULL,
[IsDeleted] [bit] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Purchase] ADD CONSTRAINT [PK_Purchase] PRIMARY KEY CLUSTERED  ([PurchaseId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Purchase] ADD CONSTRAINT [FK_Purchase_Order] FOREIGN KEY ([OrderId]) REFERENCES [dbo].[Order] ([OrderId])
GO
ALTER TABLE [dbo].[Purchase] ADD CONSTRAINT [FK_Purchase_Product] FOREIGN KEY ([ProductId]) REFERENCES [dbo].[Product] ([ProductId])
GO
